import request  from "@/utils/request.js"

//获取文章
export const getArticle=(params)=>{
    return request({
        method:'GET',
        url:`/mp/v1_0/articles`,
        params
        
    })
}
//获取频道
export const getChannels=()=>{
    return request({
        method:'GET',
        url:`/mp/v1_0/channels`,
        
    })
}
//删除文章
export const deleteArticle=(id)=>{
    return request({
        method:'DELETE',
        url:`/mp/v1_0/articles/${id}`,
    
    })
}
//发表文章
export const publishArticle=(data,draft)=>{
    return request({
        method:'POST',
        url:`/mp/v1_0/articles`,
        params:{
            draft
        },
        data
    })
}
//获取指定文章
export const getOne=(id)=>{
    return request({
        method:'GET',
        url:`/mp/v1_0/articles/${id}`,
    
    })
}
//修改文章评论状态
export const updateStatus=(article_id,allow_comment)=>{
    return request({
        method:'PUT',
        url:`/mp/v1_0/comments/status`,
        params:{
            article_id
        },
        data:{
            allow_comment
        }
    
    })
}